/*

	ILightSource.h
	
	Interface implementation for all light sources.
	Contains common methods to handle these lights
	using basic OpenGL lighting.
	
	Written by Sigurd Suhm 2009

*/

#ifndef _ILIGHTSOURCE_H
#define _ILIGHTSOURCE_H

// Includes
#include "SceneManager.h"		// Scene manager header
#include "Color.h"				// Color class header

#include <SDL/SDL_opengl.h>		// OpenGL header

namespace EraAstral
{
	namespace graphics
	{
		// Enum describing light source types
		typedef enum
		{
			// Positional light source
			LST_POSITION = 0,
			// Directional light source
			LST_DIRECTION,
			// Ambient light source
			LST_AMBIENT
		} LightSourceType;	
	
		class ILightSource
		{
			protected:
				// Light source type
				LightSourceType		m_type;
				// OpenGL light used
				GLenum		m_glLight;
				
				// Color of the light
				Color4f		*m_color;
				// Is the light source enabled?
				bool		m_enabled;
				
				// Scene manager that the light is associated with
				core::SceneManager *m_smgr;

			public:
				// Lights source interface base constructor
				ILightSource(core::SceneManager *sceneManager);
				// Virtual base destructor
				virtual ~ILightSource();
			
				// Commits light source data to OpenGL
				virtual void	Commit() = 0;
				// Applies the lighting to the scene
				virtual void	Apply() = 0;
				
				// Accessors
				LightSourceType GetType() const;
				GLenum			GetGLLightEnum();
				
				Color4f			*GetColor() const;
				void			SetColor(const Color4f& color);
				bool			IsEnabled() const;
				void			SetEnabled(bool value);
		};
	}
}

#endif		// _ILIGHTSOURCE_H